package com.yellow.orderservice.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yellow.orderservice.entity.Order;
import com.yellow.orderservice.entity.Sender;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SenderMapper extends BaseMapper<Sender> {

   @Select("SELECT o.* FROM orders o " +
            "INNER JOIN customer_orders co ON o.order_id = co.order_id " +
            "INNER JOIN sender s ON co.customer_id = s.sender_id " +
            "WHERE s.name = #{name}")
    List<Order> getOrdersBySenderName(@Param(value = "name") String name);
}
